package com.zhanglijie.theory.produceandconsume;

import com.sun.xml.internal.bind.v2.model.core.ID;

/**
 * @author zhanglijie
 * @version 1.0
 * @since 1.1.0 2022/8/13 0013 19:43
 */
public class Producer extends Thread{
    private MyQueue queue;
    public Producer(String name,MyQueue queue){
        super(name);
        this.queue = queue;
    }

    @Override
    public void run() {
        try{
            while (true) {
                long id = IdGenerate.getID();
                queue.put("data"+id);
               // Thread.sleep(500);
            }
        }catch (Exception e){
            e.printStackTrace();
        }
    }
}
